/*
 * Copyright (c) csii.com.cn 2016 zhaojin
 */

package com.csii.ssm.controller.tianhong;

import com.csii.ssm.common.HeadFormatter;
import com.csii.ssm.controller.BaseController;
import com.csii.ssm.virwebservice.SvcServiceStub;
import com.csii.ssm.virwebservice.SvcServiceStub.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;

import javax.inject.Inject;
import javax.servlet.ServletContext;

/**
 * Created by Charis on 16/9/1.
 */
public abstract class ThBaseController extends BaseController{

    Logger logger = LoggerFactory.getLogger(ThBaseController.class);

    @Inject
    protected HeadFormatter headFormatter;

    @Value("#{mvcContext['app.channelId']}")
    protected String channelId;

    @Value("#{mvcContext['app.orgCode']}")
    protected String orgCode;

    @Value("#{mvcContext['app.tellerNo']}")
    protected String tellerNo;

    protected ServletContext servletContext;


    /**
     * 根据交易码设置上送SvcInfo的公用参数
     * @param transcode
     * @return
     */
    public SvcInfo getComSvcInfo(String transcode) {
        SvcInfo comSvcInfo = new SvcInfo();
        comSvcInfo.setTxnId((String) headFormatter.getTxnMaping().get(transcode));
        comSvcInfo.setChnl(channelId);
        comSvcInfo.setOrgCode(orgCode);
        comSvcInfo.setTeller(tellerNo);
        return comSvcInfo;
    }
}
